package com.inspur.edp.paasuser.config;

import com.inspur.edp.paasuser.SynchronizationInfoService;
import com.inspur.edp.paasuser.service.impl.SynchronizationInfoServiceImpl;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@Configuration
@EnableJpaRepositories("com.inspur.edp.paasuser.dao")
@EntityScan("com.inspur.edp.paasuser.domain")
public class PaasUserConfig {
    @Bean
    public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
        return new RestTemplate(factory);
    }

    @Bean
    public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setReadTimeout(150000); // ms
        factory.setConnectTimeout(150000); // ms
        return factory;
    }
    @Bean
    public SynchronizationInfoService getSynchronizationInfoService(){
        return new SynchronizationInfoServiceImpl();
    }
}
